<template>
  <div>
    <!-- 按键修饰符
    .enter
    .esc -->
      用户名: <input @keydown.enter="fn" type="text" ><br>
      用户名: <input @keydown.13="fn" type="text" ><br>
      密码: <input @keydown.esc="fn2" type="text" >
  </div>
</template>

<script>
export default {
  name: 'VueApp',

  data() {
    return {
      
    };
  },

  methods: {
    fn(){
      console.log('用户按下了回车键');
    },
    fn2(){
      console.log('用户按下了esc');
    }
  },
};
</script>

<style lang="scss" scoped>

</style>